home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / DATABASE / S9303.ZIP;1 / SPENCE.ZIP / ABCLASSY.PRG next >
Encoding:
Text File  |  1993-01-06  |  983 b   |  38 lines

  1. // AbClassy.prg
  2. //
  3. // Specification and implementation of array browsing
  4. // class using Class(y).
  5.  
  6. #include "Class(Y).ch"
  7.  
  8. CREATE CLASS arrayBrowse FROM TBrowse
  9.  
  10. EXPORT:
  11.   VAR arrayIndex
  12.   VAR arrayReference
  13.  
  14.   METHOD Init
  15.  
  16. END CLASS
  17.  
  18.  
  19. // Extra set of parens ensures parent constructor gets invoked
  20. METHOD Init(), ()
  21.  
  22.   ::arrayIndex := 1
  23.   ::goTopBlock    := {|| ::arrayIndex := 1 }
  24.   ::goBottomBlock := {|| ::arrayIndex := Len(::arrayReference) }
  25.  
  26.   // Standard array skipper
  27.   ::skipBlock     := {|nToSkip, nTemp| ;
  28.                        nTemp := ::arrayIndex, ;
  29.                        ::arrayIndex := ;
  30.                          iif(nToSkip > 0, ;
  31.                              Min(::arrayIndex + nToSkip,      ;
  32.                                  Len(::arrayReference)),      ;
  33.                              Max(1, ::arrayIndex + nToSkip)), ;
  34.                        ::arrayIndex - nTemp                   ;
  35.                        }
  36.  
  37. RETURN Self
  38.